package java6681.lesson13;

public class Student {
    private String name;
    private int age;

    public Student() {
    }

    public Student(String name, int age) throws AgeRangeException6681 {
        this.name = name;
        setAge(age);
        //this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) throws AgeRangeException6681 {
        if (age >= 12 && age <= 35) {
            this.age = age;
        } else {
            throw new AgeRangeException6681("学生年龄应该在12——35之间");
        }

    }
}
